home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / nextrad.lha / NeXtRad / CView.m < prev    next >
Encoding:
Text File  |  1993-02-22  |  2.4 KB  |  150 lines

  1. /*
  2.  * CView.m:
  3.  *
  4.  * implements CView  (subclass of view that handles user events)
  5.  * written by : Jason R. Wilson  2/21/93
  6.  */
  7.  
  8. #import "CView.h"
  9. #import <dpsclient/wraps.h>
  10. #import "NeXtInterface.h"
  11. #import "engine.h"
  12. #import <appkit/graphics.h>
  13.  
  14. @implementation CView
  15.  
  16. - clear:sender /* clear the screen */
  17. {
  18.   [self lockFocus];
  19.   NXEraseRect(&bounds);
  20.   DrawButtons();
  21.   PSflushgraphics();
  22.   [self unlockFocus];
  23.   return self;
  24. }
  25.  
  26. - wireframe:sender /* draw the full wireframe */
  27. {
  28.   [self lockFocus];
  29.   DrawButtons();
  30.   WireFrameFull();
  31.   PSsetgray(NX_BLACK);
  32.   PSstroke();
  33.   PSflushgraphics();
  34.   [self unlockFocus];
  35. }
  36.  
  37. - refresh:sender /* render the scene (shaded) */
  38. {
  39.   renderit();
  40.   Update();
  41.   return self;
  42. }
  43.  
  44. - forward:sender /* move forward */
  45. {
  46.   ChangeView(1);
  47.   [self lockFocus];    
  48.   NXEraseRect(&bounds);
  49.   DrawButtons();
  50.   WireFrame();
  51.   PSsetgray(NX_BLACK);
  52.   PSstroke();
  53.   PSflushgraphics();
  54.   [self unlockFocus];
  55.   return self;
  56. }
  57.  
  58. - backward:sender /* move backward */
  59. {
  60.   ChangeView(2);
  61.   [self lockFocus];    
  62.   NXEraseRect(&bounds);
  63.   DrawButtons();
  64.   WireFrame();
  65.   PSsetgray(NX_BLACK);
  66.   PSstroke();
  67.   PSflushgraphics();
  68.   [self unlockFocus];
  69.   return self;
  70. }
  71.  
  72. - turnleft:sender /* turn to the left */
  73. {
  74.   ChangeView(3);
  75.   [self lockFocus];    
  76.   NXEraseRect(&bounds);
  77.   DrawButtons();
  78.   WireFrame();
  79.   PSsetgray(NX_BLACK);
  80.   PSstroke();
  81.   PSflushgraphics();
  82.   [self unlockFocus];
  83.   return self;
  84. }
  85.  
  86. - turnright:sender /* turn to the right */
  87. {
  88.   ChangeView(4);
  89.   [self lockFocus];    
  90.   NXEraseRect(&bounds);
  91.   DrawButtons();
  92.   WireFrame();
  93.   PSsetgray(NX_BLACK);
  94.   PSstroke();
  95.   PSflushgraphics();
  96.   [self unlockFocus];
  97.   return self;
  98. }
  99.  
  100. - tiltup:sender  /* tilt head up */
  101. {
  102.   ChangeView(5);
  103.   [self lockFocus];    
  104.   NXEraseRect(&bounds);
  105.   DrawButtons();
  106.   WireFrame();
  107.   PSsetgray(NX_BLACK);
  108.   PSstroke();
  109.   PSflushgraphics();
  110.   [self unlockFocus];
  111.   return self;
  112. }
  113.  
  114. - tiltdown:sender /* tilt head down */
  115. {
  116.   ChangeView(6);
  117.   [self lockFocus];    
  118.   NXEraseRect(&bounds);
  119.   DrawButtons();
  120.   WireFrame();
  121.   PSsetgray(NX_BLACK);
  122.   PSstroke();
  123.   PSflushgraphics();
  124.   [self unlockFocus];
  125.   return self;
  126. }
  127.  
  128. - movefaster:sender /* move and turn faster */
  129. {
  130.   Faster();
  131. }
  132.  
  133. - moveslower:sender /* move and turn slower */
  134. {
  135.   Slower();
  136. }
  137.  
  138. - outputPPM:sender /* output view to a .ppm file */
  139. {
  140.   OutputPPM();
  141. }
  142.  
  143. - subdivide:sender /* perform and adaptive subdivision pass */
  144. {
  145.   adapt();
  146.   renderit();
  147.   Update();
  148.   return self;
  149. }
  150.